package written_test;

import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;

import java.util.*;
import java.util.stream.Stream;

/**
 * @author zhx
 * @since 2020-09-12
 */
public class YuanFuDao {

    public static void main1(String[] args) {
    // 100
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        List<Integer> arr = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            arr.add(in.nextInt());
        }
        in.close();
        for (int i = 0; i < m; i++) {
            arr = shuffle(arr, n);
        }
        arr.forEach((integer) -> {
            System.out.print(integer + " ");
        });

    }

    public static List<Integer> shuffle(List<Integer> arr, int n) {
        Stack<Integer> head = new Stack<>();
        Stack<Integer> tail = new Stack<>();
        List<Integer> res = new ArrayList<>(n);
        for (int i = 0; i < n / 2; i++) {
            head.push(arr.get(i));
        }
        Collections.reverse(head);
        tail.addAll(arr.subList(n / 2, n));
        Collections.reverse(tail);
        while (!head.empty() || !tail.empty()) {
            res.add(tail.pop());
            try {
                res.add(head.pop());
            } catch (EmptyStackException e) {

            }
        }
        return res;
    }


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        List<String> expr = new ArrayList<>(t);
        for (int i = 0; i < t; i++) {
            expr.add(in.nextLine());
        }

    }

    public static void calc(String expr){
        Stack<String> stack = new Stack<>();
        expr.replace(" ","");
        if (!expr.startsWith("(")){
            System.out.println("invalid");
            return;
        }
        char[] chars = expr.toCharArray();
        for (char c:chars){
            if (c != ')'){
                stack.push(String.valueOf(c));
            } else {

                    int b = Integer.parseInt(String.valueOf(stack.pop()));
                    int a = Integer.parseInt(String.valueOf(stack.pop()));
                    switch (stack.pop()){
                        case "+":
                            stack.pop();
                            stack.push(String.valueOf((char) (a+b)));
                            break;
                    }
            }
        }
    }
}
